import React from 'react';
import Header from '../components/Header.js';
import {connect} from 'react-redux';
import {AcADDB} from '../redux/store/test.js';

class Home extends React.Component{
    constructor(props){
        super(props);
    }
    componentDidMount(){
        !this.props.test.b && this.props.doAddA();
    }
    render(){
        console.log(this.props);
        return <div>{this.props.children}<button onClick={()=>{this.props.doAddA()}}></button><div onClick={()=>{alert(2100991881233)}}><Header />--{this.props.test.b}--storestoree0e--xxs--vxshome</div></div>
    }
}
Home.loadData = (store) => {
   // 这个负责在服务端路由加载把数据加载好。
   return store.dispatch(AcADDB(1))
};
export default connect((state)=>({test:state.Test}),
(dispatch) => ({
    doAddA:()=>{
        console.log(1122);
        dispatch(AcADDB(1));
    }
})
)(Home);


